Unit DesenhaT;





Interface

uses
GlobVar,Crt,Graph,escreva,LeCelula,iniciar,CalNVC;


Procedure Beep(Hertz : integer);
Procedure CalcArea;
Procedure EscrevaQuadro;
Procedure EscrevaQuadro2;
procedure reticulado;
procedure reticulado2;


Implementation



Procedure Beep(Hertz : integer);
begin
  sound(hertz);
  delay(50);
  Nosound;
end;

Procedure CalcArea;

const g=1.04;
    cal = 0.20;
    calv = 1.43;
var
   xxx    :  real;
   acum   :  real;
   ref    :  real;
   Y1     :  integer;
   kk     :  integer;
   v1,v2,v3  : integer;

begin
(*** v1:=xo;
 v2:=v;
 ref:=(cal*EscX[IEscX]/5)*(v-v1)*
 0.03333*(EscY[IescY]*(abs(buffer[u+EscX[IEscX]*v1 div 2]))/calY[IescY]);
 Y1:=a+ptInicial+10*buffer[u+EscX[IEscX]*(v1-1) div 2] div calY[IescY];
 acum:=0;
 for kk:=V1 to v2 do begin
  acum:=acum+
  0.030*EscY[IescY]*(abs(((buffer[u+EscX[IEscX]*kk div 2])-(buffer[u+EscX[IEscX]*(v1-1) div 2]))/calY[IescY]));
  line(m*kk,Y1,
  m*kk,a+Ptinicial+10*buffer[u+EscX[IEscX]*kk div 2] div calY[IescY]);
 end;
 If (not dividido) then acum:=acum/150 else acum:=acum/1.5;
 nervou.memI[Imem,4]:=(cal*EscX[IEscX]/5)*acum;
 setfillstyle(9,9);
 if nervou.memI[Imem,4]<10 then WriteText(PosX+198+hx,pos2Y+PosY2janCont+hh+(Imem)*h,real1str(nervou.memI[Imem,4]))
 else WriteText(PosX+198+hx,pos2Y+PosY2janCont+hh+(Imem)*h,real0str(nervou.memI[Imem,4]));
 setfillstyle(0,1);**)
end;



(******************************Programa CN************************

Procedure EscrevaQuadro;
var ii,jj : integer;

begin
    setFillStyle(9,9);
    for ii:= 1 to 7 do
    if nervou.esp[ii]<>#0 then
       begin
         WriteText(PosX+320,pos2Y+PosY2janCont+(ii)*h,nervou.esp[ii]);
         WriteText(PosX+3,pos2Y+PosY2janCont+(ii)*h,Int2Str(ii));
       end;
      if nervou.esp[ii]<>#0 then
      WriteText(PosX+320,pos2Y+PosY2janCont+(ii)*h,nervou.esp[ii]);
for ii:= 1 to 7 do begin
    {for jj:=1 to 7 do If abs(nervou.memI[ii,jj])>32300 then nervou.memI[ii,jj]:=0;}
end;
    for Imem:=1 to 7 do
 begin {1}
    IescY:=round(nervou.memI[Imem,6]);
    If Not ((nervou.dados[1,Imem]='') or (nervou.dados[1,Imem]=' ')) then
  begin
    If abs(nervou.memI[Imem,1])>0.01 then
    WriteText(PosX+35+hx,pos2Y+PosY2janCont+hh+(Imem)*h,real2Str(nervou.MemI[Imem,1]));
    If abs(nervou.memI[Imem,4])>0.01 then
    WriteText(PosX+198+hx,pos2Y+PosY2janCont+hh+(Imem)*h,real0str(nervou.memI[Imem,4]));
    If abs(nervou.memI[Imem,3])>0.01 then
    WriteText(PosX+150+hx,pos2Y+PosY2janCont+hh+(Imem)*h,real2str(nervou.memI[Imem,3]));
    If (nervou.memI[Imem,2])>0.001 then begin
            deltaYO:=nervou.memI[Imem,2];
             case IescY of
        1..3  :  Writetext(PosX+90+hx,pos2Y+hh+PosY2janCont+(Imem)*h,real2str(DeltaYO/1000)+'uV');
        4..12 :  begin
                    If (round(abs(deltaYO))<100) then
                    Writetext(PosX+90+hx,pos2Y+hh+PosY2janCont+(Imem)*h,real1str(DeltaYO)+'uV')
                    else  Writetext(PosX+90+hx,pos2Y+hh+PosY2janCont+(Imem)*h,real2str(DeltaYO/1000)+'mV');
                 end;
        12..16:  Writetext(PosX+90+hx,pos2Y+hh+PosY2janCont+(Imem)*h,real1str(DeltaYO)+'mV');
      end;



    end;
  end else
  end;
  Imem:=2;
  for XI:=1 to 4 do begin
    for YJ:=1 to 7 do begin
       ajustaTamanho;
       apagacell(CXPos[XI],CYPos[YJ],tamanho);
       end;
       end;
       XI:=1;
    for YJ:=7 to 13 do begin
       ajustaTamanho;
       apagacell(CXPos[XI],CYPos[YJ],tamanho);
    end;
    setviewPort(initX,InitY,FinX,FinY,true);
  setFillstyle(1,0);
end;

Procedure EscrevaQuadro2;
var ii,jj : integer;

begin
    setFillStyle(11,9);
    for ii:= 1 to 7 do
    if nervou.esp[ii]<>#0 then
       begin
         WriteText(PosX+320,pos2Y+PosY2janCont+(ii)*h,nervou.esp[ii]);
         WriteText(PosX+3,pos2Y+PosY2janCont+(ii)*h,Int2Str(ii));
       end;
      if nervou.esp[ii]<>#0 then
      WriteText(PosX+320,pos2Y+PosY2janCont+(ii)*h,nervou.esp[ii]);
for ii:= 1 to 7 do begin
    {for jj:=1 to 7 do If abs(nervou.memI[ii,jj])>32300 then nervou.memI[ii,jj]:=0;}
end;
    for Imem:=1 to 7 do
 begin {1}
    IescY:=round(nervou.memI[Imem,6]);
    If nervou.dados[Imem,1]>'' then
    begin
    If abs(nervou.memI[Imem,1])>0.01 then
    WriteText(PosX+35+hx,pos2Y+PosY2janCont+hh+(Imem)*h,real2Str(nervou.MemI[Imem,1]));
    If abs(nervou.memI[Imem,4])>0.01 then
    WriteText(PosX+198+hx,pos2Y+PosY2janCont+hh+(Imem)*h,real0str(nervou.memI[Imem,4]));
    If abs(nervou.memI[Imem,3])>0.01 then
    WriteText(PosX+150+hx,pos2Y+PosY2janCont+hh+(Imem)*h,real2str(nervou.memI[Imem,3]));
     If (nervou.memI[Imem,2])>0.001 then begin
       deltaYO:=nervou.memI[Imem,2];
              case IescY of
        1..3  :  Writetext(PosX+90+hx,pos2Y+hh+PosY2janCont+(Imem)*h,real2str(DeltaYO/1000)+'uV');
        4..12 :  begin
                    If (round(abs(deltaYO))<100) then
                    Writetext(PosX+90+hx,pos2Y+hh+PosY2janCont+(Imem)*h,real1str(DeltaYO)+'uV')
                    else  Writetext(PosX+90+hx,pos2Y+hh+PosY2janCont+(Imem)*h,real2str(DeltaYO/1000)+'mV');
                 end;
        12..16:  Writetext(PosX+90+hx,pos2Y+hh+PosY2janCont+(Imem)*h,real1str(DeltaYO)+'mV');
      end;


      end;
     end;
    end;
  Imem:=2;
  for XI:=1 to 4 do begin
    for YJ:=1 to 7 do begin
       ajustaTamanho;
       apagacell(CXPos[XI],CYPos[YJ],tamanho);
       end;
       end;
       XI:=1;
   for YJ:=7 to 13 do begin
       ajustaTamanho;
       apagacell(CXPos[XI],CYPos[YJ],tamanho);
    end;
    setviewPort(initX,InitY,FinX,FinY,true);
  setFillstyle(1,0);
end;



*************************************)



{_-----------------     ECN          ____________}


Procedure EscrevaQuadro;
var ii,jj,x : integer;

begin

    for Imem:=1 to 7 do
 begin {1}
    IescY:=round(nervou.memI[Imem,6]);
    If Not ((nervou.dados[1,Imem]='') or (nervou.dados[1,Imem]=' ')) then

    If abs(nervou.memI[Imem,2])>0.0001 then
       begin
           case nervou.mem[1648,imem] of
              10000  :  setcolor(15);
              5000     :  setcolor(4);
              3000    :  setcolor(3);
            end;
    WriteT(PosX+35+hx,pos2Y+PosY2janCont+hh+(Imem)*h,real2Str(nervou.MemI[Imem,1]));
    setcolor(15);
    end;
    If abs(nervou.memI[Imem,3])>0.0001 then

       begin
            case nervou.mem[1649,imem] of
              10000  :  setcolor(15);
              5000     :  setcolor(4);
              3000    :  setcolor(3);
            end;
    WriteT(PosX+150+hx,pos2Y+PosY2janCont+hh+(Imem)*h,real2str(nervou.memI[Imem,3]));
    setcolor(15);
    end;
end;

for Imem:= 1 to 7 do begin
    x:=Imem;
    If (nervou.memI[Imem,2])>0.001 then begin
            case nervou.mem[1647,imem] of
              10000  :  setcolor(15);
              5000     :  setcolor(4);
              3000    :  setcolor(3);
            end;
            deltaYO:=nervou.memI[Imem,2];



     IescY:=round(nervou.memI[Imem,6]);
     ganho:=round(nervou.memI[Imem,7]);

     DefineCalibracaoY;

     case IescY of
        1..3  :  Writet(PosX+90+hx,pos2Y+hh+PosY2janCont+(x)*h,real2str(DeltaYO/1000)+'uV');
        4..12 :  begin
                    If (round(abs(deltaYO))<100) then
                    Writet(PosX+90+hx,pos2Y+hh+PosY2janCont+(x)*h,real1str(DeltaYO)+'uV')
                    else  Writet(PosX+90+hx,pos2Y+hh+PosY2janCont+(x)*h,real2str(DeltaYO/1000)+'mV');
                 end;
        12..16:  begin
                    If (round(abs(deltaYO))>99) then
                    Writet(PosX+90+hx,pos2Y+hh+PosY2janCont+(x)*h,real2str(DeltaYO/1000)+'mV')
                    else  Writet(PosX+90+hx,pos2Y+hh+PosY2janCont+(x)*h,real1str(DeltaYO)+'mV')
                 end;
     end;
     end;
    setcolor(15);
  end;

  Imem:=2;
  for XI:=1 to 4 do begin
    for YJ:=1 to 7 do begin
       ajustaTamanho;
       apagacell(CXPos[XI],CYPos[YJ],tamanho);
       end;
       end;
       XI:=1;
    for YJ:=7 to 13 do begin
       ajustaTamanho;
       apagacell(CXPos[XI],CYPos[YJ],tamanho);
    end;
    setviewPort(initX,InitY,FinX,FinY,true);
    setFillStyle(9,9);
    setcolor(15);
    for ii:= 1 to 7 do
    if nervou.esp[ii]<>#0 then
          begin
         WriteText(PosX+320,pos2Y+PosY2janCont+(ii)*h,nervou.esp[ii]);
         WriteText(PosX+3,pos2Y+PosY2janCont+(ii)*h,Int2Str(ii));
       end;
  setFillstyle(1,0);
  setcolor(15);
end;

Procedure EscrevaQuadro2;
var ii,jj : integer;

begin
    setFillStyle(11,9);
    for ii:= 1 to 7 do
    if nervou.esp[ii]<>#0 then
       begin
         WriteText(PosX+320,pos2Y+PosY2janCont+(ii)*h,nervou.esp[ii]);
         WriteText(PosX+3,pos2Y+PosY2janCont+(ii)*h,Int2Str(ii));
       end;
      if nervou.esp[ii]<>#0 then
      WriteText(PosX+320,pos2Y+PosY2janCont+(ii)*h,nervou.esp[ii]);
for ii:= 1 to 7 do begin
    {for jj:=1 to 7 do If abs(nervou.memI[ii,jj])>32300 then nervou.memI[ii,jj]:=0;}
end;
    for Imem:=1 to 7 do
 begin {1}
    IescY:=round(nervou.memI[Imem,6]);
    If nervou.dados[Imem,1]>'' then
    begin
    If abs(nervou.memI[Imem,2])>0.001 then
    WriteText(PosX+35+hx,pos2Y+PosY2janCont+hh+(Imem)*h,real2Str(nervou.MemI[Imem,1]));
    {If abs(nervou.memI[Imem,4])>-0.01 then
    WriteText(PosX+198+hx,pos2Y+PosY2janCont+hh+(Imem)*h,real0str(nervou.memI[Imem,4]));}
    If abs(nervou.memI[Imem,3])>0.001 then
    WriteText(PosX+150+hx,pos2Y+PosY2janCont+hh+(Imem)*h,real2str(nervou.memI[Imem,3]));
     If (nervou.memI[Imem,2])>0.001 then begin
       deltaYO:=nervou.memI[Imem,2];
              case IescY of
        1..3  :  Writetext(PosX+90+hx,pos2Y+hh+PosY2janCont+(Imem)*h,real2str(DeltaYO/1000)+'uV');
        4..12 :  begin
                    If (round(abs(deltaYO))<100) then
                    Writetext(PosX+90+hx,pos2Y+hh+PosY2janCont+(Imem)*h,real1str(DeltaYO)+'uV')
                    else  Writetext(PosX+90+hx,pos2Y+hh+PosY2janCont+(Imem)*h,real2str(DeltaYO/1000)+'mV');
                 end;
        12..16:  Writetext(PosX+90+hx,pos2Y+hh+PosY2janCont+(Imem)*h,real1str(DeltaYO)+'mV');
      end;


      end;
     end;
    end;
  Imem:=2;
  for XI:=1 to 4 do begin
    for YJ:=1 to 7 do begin
       ajustaTamanho;
       apagacell(CXPos[XI],CYPos[YJ],tamanho);
       end;
       end;
       XI:=1;
   for YJ:=7 to 13 do begin
       ajustaTamanho;
       apagacell(CXPos[XI],CYPos[YJ],tamanho);
    end;
    setviewPort(initX,InitY,FinX,FinY,true);
  setFillstyle(1,0);
end;




procedure reticulado;

var vv:integer;
   cor: integer;

          begin
             Inicia_Tela;
             setfillstyle(1,8);
             {bar(initx,inity,finx,finy);}
             setwritemode(1);
             setcolor(8);
             setBkcolor(0);
             setLineStyle(dottedLn,0,NormWidth);
             for vv:=0 to NumColunas-1 do begin
              for v:=1 to NumLinhas do
              begin
              line(initx+round(vv*(Finx-Initx)/NumColunas),inity+round(((Finy-inity)/NumLinhas)*v),InitX+2
              +round(vv*(Finx-Initx)/NumColunas),inity+round(((Finy-inity)/NumLinhas)*v));
              end;
              end;
              for v:=1 to NumLinhas do
               begin
               line(initx,inity+round(((Finy-inity)/NumLinhas)*v),InitX+8,inity+round(((Finy-inity)/NumLinhas)*v));
              end;
             for v:=1 to Numcolunas do
              begin
              line(initx+round(v*(Finx-Initx)/NumColunas),inity,initx+round(v*(Finx-Initx)/NumColunas),InitY+12);
             end;
             setLineStyle(solidLn,0,NormWidth);
             setColor(15);

             rectangle(initx,inity,finx,finy);
             EScalas;
             SetViewPort(initx,inity,finx,finy,clipon);
             setwritemode(1);
             MostraResultados;
             SetColor(15);
         end;

procedure reticulado2;

var vv:integer;
    cor: integer;

          begin
             Inicia_Tela2;
             setwritemode(1);
             setcolor(8);
             setBkcolor(0);
             setLineStyle(dottedLn,0,NormWidth);
             for vv:=0 to NumColunas-1 do begin
              for v:=1 to NumLinhas do
              line(initx+round(vv*(Finx-Initx)/NumColunas),inity+round(((Finy-inity)/NumLinhas)*v),InitX+2
              +round(vv*(Finx-Initx)/NumColunas),inity+round(((Finy-inity)/NumLinhas)*v));
              end;
              for v:=1 to NumLinhas do
             line(initx,inity+round(((Finy-inity)/NumLinhas)*v),InitX+8,inity+round(((Finy-inity)/NumLinhas)*v));
             for v:=1 to Numcolunas do
              line(initx+round(v*(Finx-Initx)/NumColunas),inity,initx+round(v*(Finx-Initx)/NumColunas),InitY+8);
             setLineStyle(solidLn,0,NormWidth);
             setColor(15);
             rectangle(initx,inity,finx,finy);
             {line(round(initx+(finx-initx)/2),inity,initx+round((finx-initx)/2),finy);
             line(initx,inity+round((finy-inity)/2),finx,inity+round((finy-inity)/2));}
             {MostraResultados;}
             SetViewPort(initx,inity,finx,finy,clipon);
             setwritemode(1);
             SetColor(15);
         end;
end.